<?php
namespace Home\Controller;
use Think\Controller;

use  Home\Model\FoodsModel;
use  Home\Model\MerchantModel;

class MerchantController extends Controller {
    /**
     * 商户首页
     */
    public function index(){
      $Foods = new FoodsModel();
      $MerchantModel=new MerchantModel();
      $mid=I('get.mid');
      if(empty($mid)||!$MerchantModel->exists($mid))
        $this->redirect('Index/index');
      else{
        session('mid',$mid);
        $this->foods=$Foods->getAllByMid($mid);
        $this->display();
      }
    }
}
